Note
Go to the end to download the full example code.
Quench of the quantum Ising model in 2d.
# pylint: disable=invalid-name
import qtealeaves as qtl
from qtealeaves.models import get_quantum_ising_2d
def main(tn_type=5, input_folder=None, output_folder=None, timesteps=160):
"""
Main method for the simulation of the dynamics of a
2d quantum Ising model.
**Arguments**
tn_type : int, optional
Choose 5 for python-TTN, 6 for python-MPS.
Default to 5.
input_folder : str | None, optional
Input folder. Default to None.
output_folder : str | None, optional
Output folder. Default to None.
timesteps : int, optional
NUmber of timesteps. Default to 160.
"""
if input_folder is None:
input_folder = lambda params: "QI2dDyn/input_L%d" % (params["L"])
if output_folder is None:
output_folder = lambda params: "QI2dDyn/output_L%d" % (params["L"])
model, my_ops = get_quantum_ising_2d()
my_conv = qtl.convergence_parameters.TNConvergenceParameters(
max_iter=5, max_bond_dimension=32
)
my_obs = qtl.observables.TNObservables()
# Dynamics
quench = qtl.DynamicsQuench([0.05] * timesteps, time_evolution_mode=2)
quench["g"] = lambda tt, params: 1 - tt / 8.0
simulation = qtl.QuantumGreenTeaSimulation(
model,
my_ops,
my_conv,
my_obs,
tn_type=tn_type,
folder_name_input=input_folder,
folder_name_output=output_folder,
store_checkpoints=False,
)
params = []
params.append(
{
"L": 4,
"g": 1.0,
"J": 0.0,
"Quenches": [quench],
"exclude_from_hash": ["Quenches"],
}
)
simulation.run(params, delete_existing_folder=True)
print(f"\nExample `{__file__}` ran successfully; no asserts implemented.")
return
if __name__ == "__main__":
main()